def filesize(size, bucketsize=1024):
    buckets = []
    while True:
        buckets.append(('%d' if (size < bucketsize) else '%03d') % (size % bucketsize))
        size /= bucketsize
        if size == 0:
            break
    return ','.join(reversed(buckets))

if __name__ == '__main__':
    print filesize(0)
    print filesize(1)
    print filesize(1023)
    print filesize(1024)
    print filesize(1025)
    print filesize(2*1024*1024*1024)
    print filesize(2*1024*1024*1024, 1000)